﻿<div class="page type-interior pluginConfigurationPage" data-require="emby-input,emby-button,emby-select,emby-checkbox" data-role="page" id="bangumiConfigurationPage">
    <link href="configurationpage?name=Plugin.Bangumi.Configuration.Style" rel="stylesheet"/>
    <div data-role="content">
        <div class="content-primary">
            <form id="bangumiConfigurationForm">
                <div class="verticalSection">
                    <div class="sectionTitleContainer flex align-items-center">
                        <h2 class="sectionTitle">账号授权</h2>
                    </div>
                </div>
                <div id="bangumi-oauth-container">
                    <div class="bangumi-user-info">
                        <div class="user-info">
                            <div class="user-avatar">
                                <span class="material-icons person"></span>
                            </div>
                            <div class="user-name">未登录</div>
                            <a class="profile-link fab" href="https://bgm.tv/" target="_blank">
                                <span class="material-icons open_in_new"></span>
                            </a>
                        </div>
                    </div>
                    <div class="bangumi-oauth-status"></div>
                    <button class="raised emby-button" id="bangumi-oauth-refresh" is="emby-button" style="display: none"
                            type="button">
                        <span>延长授权时间</span>
                    </button>
                    <button class="raised emby-button" id="bangumi-oauth-btn" is="emby-button" type="button">
                        <span>授权登录 Bangumi</span>
                    </button>
                    <button class="emby-button button-link" id="bangumi-oauth-manual-btn" is="emby-button"
                            type="button">
                        <span>手动填写</span>
                    </button>
                    <button class="raised emby-button" id="bangumi-oauth-delete" is="emby-button" style="display: none"
                            type="button">
                        <span>取消授权</span>
                    </button>
                </div>
                <div class="selectContainer">
                    <div class="checkboxContainer checkboxContainer-withDescription">
                        <label class="emby-checkbox-label">
                            <input id="ReportPlaybackStatusToBangumi" is="emby-checkbox" type="checkbox"/>
                            <span>同步播放进度到 Bangumi</span>
                        </label>
                    </div>
                </div>
                <div class="selectContainer">
                    <div class="checkboxContainer checkboxContainer-withDescription">
                        <label class="emby-checkbox-label">
                            <input id="ReportManualStatusChangeToBangumi" is="emby-checkbox" type="checkbox"/>
                            <span>同步手动更新后的播放状态到 Bangumi</span>
                        </label>
                    </div>
                </div>
                <div class="selectContainer">
                    <div class="checkboxContainer checkboxContainer-withDescription">
                        <label class="emby-checkbox-label">
                            <input id="SkipNSFWPlaybackReport" is="emby-checkbox" type="checkbox"/>
                            <span>忽略被标记为 NSFW 的内容</span>
                        </label>
                    </div>
                </div>
                <div class="verticalSection">
                    <div class="sectionTitleContainer flex align-items-center">
                        <h2 class="sectionTitle">离线数据库 (Beta)</h2>
                        <a class="raised button-alt headerHelpButton emby-button" id="archive-update-schedule-link"
                           is="emby-linkbutton" style="display: none">
                            更新设置
                        </a>
                    </div>
                    <div class="fieldDescription">
                        离线数据库默认每周更新一次，当存在离线数据库时，插件会优先查询离线数据库的数据。<br>
                        如果需要禁用离线数据库，请关闭计划任务并清理本地文件。
                    </div>
                </div>
                <div class="paperList" id="bangumi-archive-container">
                    <div class="listItem listItem-border">
                        <div class="listItemBody two-line">
                            <div class="listItemBodyText secondary" style="margin:0">目录</div>
                            <div class="listItemBodyText" id="archive-folder">-</div>
                        </div>
                    </div>
                    <div class="listItem listItem-border archive-data-required">
                        <div class="listItemBody two-line">
                            <div class="listItemBodyText secondary" style="margin:0">大小</div>
                            <div class="listItemBodyText" id="archive-size">0</div>
                        </div>
                        <button id="delete-archive-data" is="paper-icon-button-light" title="删除离线数据库"
                                type="button">
                            <span aria-hidden="true" class="material-icons delete"></span>
                        </button>
                    </div>
                    <div class="listItem listItem-border archive-data-required">
                        <div class="listItemBody two-line">
                            <div class="listItemBodyText secondary" style="margin:0">上次更新时间</div>
                            <div class="listItemBodyText" id="archive-update-time">-</div>
                        </div>
                        <button id="config-archive-update-task" is="paper-icon-button-light" title="计划任务设置"
                                type="button">
                            <span aria-hidden="true" class="material-icons settings"></span>
                        </button>
                    </div>
                </div>
                <div class="selectContainer">
                    <label class="selectLabel" for="DaysBeforeUsingArchiveData">针对近期放送的剧集始终使用在线接口</label>
                    <select class="emby-select-withcolor emby-select" id="DaysBeforeUsingArchiveData" is="emby-select">
                        <option value="0">始终使用离线数据</option>
                        <option value="7">为 7 日前放送的剧集使用离线数据</option>
                        <option value="14">为 14 日前放送的剧集使用离线数据（推荐）</option>
                        <option value="30">为 30 日前放送的剧集使用离线数据</option>
                    </select>
                    <div class="fieldDescription">对于近期放送的条目离线数据库更新可能不及时，可通过更换在线接口缓解。</div>
                </div>
                <div class="checkboxContainer checkboxContainer-withDescription">
                    <label class="emby-checkbox-label">
                        <input id="RefreshRecentEpisodeWhenArchiveUpdate" is="emby-checkbox" type="checkbox"/>
                        <span>当离线数据库更新时更新近期放送番剧的元数据</span>
                    </label>
                    <div class="fieldDescription">
                        更新时不受元数据优先级影响强制覆盖，当默认元数据不是 Bangumi 时不建议启用。
                    </div>
                </div>
                <div class="checkboxContainer checkboxContainer-withDescription">
                    <label class="emby-checkbox-label">
                        <input id="RefreshRatingWhenArchiveUpdate" is="emby-checkbox" type="checkbox"/>
                        <span>当离线数据库更新时更新番剧评分</span>
                    </label>
                    <div class="fieldDescription">
                        离线数据库更新后自动更新所有已关联 Bangumi 词条项目的评分（注意可能覆盖其他元数据插件的评分）。
                    </div>
                </div>
                <div class="verticalSection">
                    <div class="sectionTitleContainer flex align-items-center">
                        <h2 class="sectionTitle">网络</h2>
                    </div>
                </div>
                <div class="inputContainer">
                    <label class="inputLabel inputLabelUnfocused" for="BaseServerUrl">Bangumi API 地址</label>
                    <input class="emby-input" id="BaseServerUrl" type="url"/>
                    <div class="fieldDescription">官方 API 部署在海外，请确保 Jellyfin 上能够稳定访问或配置反代站点。
                    </div>
                </div>
                <div class="selectContainer">
                    <label class="selectLabel" for="RequestTimeout">请求超时时间</label>
                    <select class="emby-select-withcolor emby-select" id="RequestTimeout" is="emby-select">
                        <option value="5000">5 秒</option>
                        <option value="10000">10 秒</option>
                        <option value="30000">30 秒</option>
                        <option value="60000">1 分钟</option>
                    </select>
                    <div class="fieldDescription">只能缓解国内访问不稳定的情况，要确保国内能稳定访问请配置代理。</div>
                </div>
                <div class="selectContainer">
                    <label class="selectLabel" for="SeasonGuessMaxSearchCount">季度搜索最大请求数</label>
                    <select class="emby-select-withcolor emby-select" id="SeasonGuessMaxSearchCount" is="emby-select">
                        <option value="1">1</option>
                        <option value="2">2</option>
                        <option value="5">5</option>
                        <option value="10">10</option>
                    </select>
                    <div class="fieldDescription">
                        本插件使用遍历搜索关联条目的方式匹配TV动画季度。大部分情况下只需一次搜索即可完成，但某些条目可能需要多次搜索才能匹配到下一季。默认最多搜索两次，如果某些季度匹配错误，您可以尝试增加最大搜索次数。
                    </div>
                </div>
                <div class="selectContainer">
                    <label class="selectLabel" for="RatingUpdateMinInterval">更新评分频率</label>
                    <select class="emby-select-withcolor emby-select" id="RatingUpdateMinInterval" is="emby-select">
                        <option value="3">3天</option>
                        <option value="7">7天</option>
                        <option value="14">14天</option>
                        <option value="30">30天</option>
                    </select>
                    <div class="fieldDescription">
                        默认不更新14天内已更新过的评分。如果评分频繁变化，可以选择更短的时间间隔以确保每次执行更新评分时都能覆盖旧的评分。
                    </div>
                </div>
                <div class="verticalSection">
                    <div class="sectionTitleContainer flex align-items-center">
                        <h2 class="sectionTitle">元数据</h2>
                    </div>
                </div>
                <div class="selectContainer">
                    <label class="selectLabel" for="TranslationPreference">标题翻译</label>
                    <select class="emby-select-withcolor emby-select" id="TranslationPreference" is="emby-select">
                        <option value="Original">优先使用日文</option>
                        <option value="Chinese">优先使用中文翻译</option>
                    </select>
                </div>
                <div class="selectContainer">
                    <label class="selectLabel" for="PersonTranslationPreference">人物名称翻译</label>
                    <select class="emby-select-withcolor emby-select" id="PersonTranslationPreference" is="emby-select">
                        <option value="Original">优先使用日文</option>
                        <option value="Chinese">优先使用中文</option>
                    </select>
                </div>
                <div class="checkboxContainer checkboxContainer-withDescription">
                    <label class="emby-checkbox-label">
                        <input id="UseBangumiSeasonTitle" is="emby-checkbox" type="checkbox"/>
                        <span>使用 Bangumi 词条作为季名称</span>
                    </label>
                    <div class="fieldDescription">会将默认的“第 * 季”替换为对应条目的标题，如 ***** ** 篇。</div>
                </div>
                <div class="checkboxContainer checkboxContainer-withDescription">
                    <label class="emby-checkbox-label">
                        <input id="TrustExistedBangumiId" is="emby-checkbox" type="checkbox"/>
                        <span>始终根据配置的 Bangumi ID 获取元数据</span>
                    </label>
                    <div class="fieldDescription">
                        默认情况下会判断 ID 是否属当前的季度，当修改系列 / 季度后可自动更新下面的剧集信息；<br>
                        启用后不再更新，直到剧集元数据中的 ID 被清除才会查询。
                    </div>
                </div>
                <div class="checkboxContainer checkboxContainer-withDescription">
                    <label class="emby-checkbox-label">
                        <input id="UseTestingSearchApi" is="emby-checkbox" type="checkbox"/>
                        <span>使用测试版 Bangumi 搜索接口</span>
                    </label>
                    <div class="fieldDescription">注：搜索结果不一定更准确。</div>
                </div>
                <div class="checkboxContainer checkboxContainer-withDescription">
                    <label class="emby-checkbox-label">
                        <input id="SortByFuzzScore" is="emby-checkbox" type="checkbox"/>
                        <span>使用 FuzzyWuzzy 算法对匹配结果排序</span>
                    </label>
                    <div class="fieldDescription">排序时会加入条目别名，提高首个条目匹配率。测试接口未启用此算法</div>
                </div>
                <div class="selectContainer">
                    <label class="selectLabel" for="EpisodeParser">剧集解析器</label>
                    <select class="emby-select-withcolor emby-select" id="EpisodeParser" is="emby-select">
                        <option value="Basic">基础剧集解析器</option>
                        <option value="AnitomySharp">AnitomySharp 剧集解析器</option>
                    </select>
                </div>
                <div class="episode-parser-options" episode-parser="Basic" style="display:none;">
                    <div class="checkboxContainer checkboxContainer-withDescription">
                        <label class="emby-checkbox-label">
                            <input id="AlwaysReplaceEpisodeNumber" is="emby-checkbox" type="checkbox" />
                            <span>始终根据文件名猜测集数</span>
                        </label>
                        <div class="fieldDescription">
                            用于修正 Jellyfin 自动识别集号错误的情况，由插件重新按文件名判断并纠正。少数情况下插件可能识别错误。
                        </div>
                    </div>
                </div>
                <div class="episode-parser-options" episode-parser="AnitomySharp" style="display:none;">
                    <div class="checkboxContainer checkboxContainer-withDescription">
                        <label class="emby-checkbox-label">
                            <input id="ProcessMultiSeasonFolderByAnitomySharp" is="emby-checkbox" type="checkbox" />
                            <span>使用 AnitomySharp 搜索多季度目录</span>
                        </label>
                        <div class="fieldDescription">
                            用于剧集，建议搭配「使用 Bangumi 词条作为季名称」使用。准确率一般，开发中……
                        </div>
                    </div>
                </div>
                <div class="verticalSection">
                    <div class="sectionTitleContainer flex align-items-center">
                        <h2 class="sectionTitle">AnitomySharp</h2>
                    </div>
                </div>
                <div class="checkboxContainer checkboxContainer-withDescription">
                    <label class="emby-checkbox-label">
                        <input id="AlwaysGetTitleByAnitomySharp" is="emby-checkbox" type="checkbox" />
                        <span>使用 AnitomySharp 猜测动画名</span>
                    </label>
                </div>
                <div class="submit-button-container">
                    <button class="raised button-submit block emby-button" is="emby-button" type="submit">
                        <span>保存</span>
                    </button>
                </div>
            </form>
        </div>
    </div>
    <script src="configurationpage?name=Plugin.Bangumi.Configuration.Script"></script>
</div>
